<?php
	class CommonAction extends Action{
		public function _initialize(){
			$this->action = ACTION_NAME;
			//判断 session 值 uid 是否存在
			if(!isset($_SESSION['uid'])){
				$this->error('请登录', U(GROUP_NAME.'/Login/index')); 	//第一种提示方法
				//$this->redirect(GROUP_NAME.'/Login/index');	//第二种直接跳转
			}

			if (!isset($_SESSION[C('USER_AUTH_KEY')])) {
				$this->error('请登录',U('Login/index'));
			}

			//var_dump(explode(',', C('NOT_AUTH_ACTION')));
			$notAuth = in_array(MODULE_NAME, explode(',', C('NOT_AUTH_MODEL'))) || in_array(ACTION_NAME, explode(',', C('NOT_AUTH_ACTION')));

			if (C('USER_AUTH_ON') && !$notAuth) {
				import('ORG.Util.RBAC');
				RBAC::AccessDecision(GROUP_NAME) || $this->error('没有权限操作');
			}
		}
	}
?>